CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(manta)


SET(BUILD_CONFIG            release)

IF(APPLE)
    SET(BUILD_PLATFORM      mac)
ENDIF()

IF(WIN32)
    SET(BUILD_PLATFORM      win)
ENDIF()


SET(DIR_ROOT                ${CMAKE_CURRENT_SOURCE_DIR})
SET(DIR_EXTERNAL            ${DIR_ROOT}/external)
SET(DIR_TEST                ${DIR_ROOT}/test)
SET(DIR_BUILD               ${CMAKE_CURRENT_BUILD_DIR})


IF(${BUILD_PLATFORM} MATCHES mac)
    SET(CC                  "clang")
    SET(CXX                 "clang++")
    SET(CFLAGS_all          "-arch x86_64 -Wall -Wextra -Werror -mmacosx-version-min=10.6 -DOS_MAC")
    SET(CFLAGS_debug        "-O0 -g -DDEBUG")
    SET(CFLAGS_release      "-O2 -DNDEBUG -fomit-frame-pointer")
    SET(CXXFLAGS            "")
    SET(LINKFLAGS           "-Qunused-arguments")
    SET(LIB_SYSTEM          "-framework CoreFoundation -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreMIDI")
ENDIF()

SET(CMAKE_C_COMPILER        ${CC})
SET(CMAKE_CXX_COMPILER      ${CXX})

SET(CMAKE_C_FLAGS           "${CFLAGS_all} ${CFLAGS_${BUILD_CONFIG}}")
SET(CMAKE_CXX_FLAGS         "${CXXFLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS  "${LINKFLAGS}")

SET(EXECUTABLE_OUTPUT_PATH  ${DIR_BUILD})
SET(LIBRARY_OUTPUT_PATH     ${DIR_BUILD})


###############################################################################

SET(DIR_MANTA               ${DIR_EXTERNAL}/libmanta)
SET(INC_MANTA               ${DIR_MANTA}/core)

SET(DIR_HIDAPI              ${DIR_EXTERNAL}/hidapi-0.7.0)
SET(INC_HIDAPI              ${DIR_HIDAPI}/hidapi)

SET(DIR_RTMIDI              ${DIR_EXTERNAL}/rtmidi-2.0.1)
SET(INC_RTMIDI              ${DIR_RTMIDI})


###############################################################################

ADD_SUBDIRECTORY(external)

INCLUDE_DIRECTORIES(${DIR_ROOT})

ADD_SUBDIRECTORY(mac)

